package o;

import android.content.Context;
import com.huawei.appgallery.forum.base.card.ForumCard;
import com.huawei.appgallery.forum.section.card.BuoyForumNoticeCard;
import com.huawei.appgallery.forum.section.card.BuoyForumSectionHeadCard;
import com.huawei.appgallery.forum.section.card.ForumNoticeCard;
import com.huawei.appgallery.forum.section.card.ForumSectionEnterCard;
import com.huawei.appgallery.forum.section.card.ForumSectionHeadCard;
import java.util.HashMap;
import java.util.Map;

public abstract class cam {
    private static Map<String, Class<?>> ˎ = new HashMap();

    public static void ˋ() {
        ˊ("forumsectionheadcard", ForumSectionHeadCard.class);
        ˊ("forumnoticecard", ForumNoticeCard.class);
        ˊ("forumsectionentercard", ForumSectionEnterCard.class);
        ˊ("buoyforumsectionheadcard", BuoyForumSectionHeadCard.class);
        ˊ("buoyforumnoticecard", BuoyForumNoticeCard.class);
    }

    public static void ˊ(String str, Class<?> cls) {
        ˎ.put(str, cls);
    }

    public static ForumCard ˊ(String str, Context context) {
        Class cls = (Class) ˎ.get(str);
        if (cls == null) {
            return null;
        }
        ForumCard forumCard;
        try {
            forumCard = (ForumCard) cls.getConstructor(new Class[]{Context.class}).newInstance(new Object[]{context});
        } catch (Throwable e) {
            bqx.ˊ("SectionDetailCardFactory", "createDetailView error, viewType:" + str, e);
            forumCard = null;
        }
        return forumCard;
    }
}
